import { createHashHistory, History } from 'history'
import thunk from 'redux-thunk'
import { createLogger } from 'redux-logger'
import { applyMiddleware, combineReducers, createStore } from 'redux'
import { composeWithDevTools } from 'redux-devtools-extension'
import rootReducer from './modules'

export const history: History = createHashHistory()

const middleware = [thunk, createLogger()]

const composedEnhancers = composeWithDevTools(applyMiddleware(...middleware))

export default createStore(combineReducers(rootReducer), composedEnhancers)
